import request from '@/utils/request'
export interface UserVO {
  memberShipName: string | number | boolean | unknown[]
  memberShip: any //是否付费会员
  memberPicUrl: any //付费会员图片路径
  arrearsPrice: string | number
  balance: any
  ppcNum: any
  ppcBalance: any
  employee: any
  activeDays: any
  tenantName: any
  couponNum: any
  targetWeight: number
  id: number
  avatar: string | undefined
  birthday: number | undefined
  createTime: number | undefined
  loginDate: number | undefined
  loginIp: string
  mark: string
  mobile: string
  name: string | undefined
  nickname: string | undefined
  registerIp: string
  sex: number
  status: number
  areaId: number | undefined
  areaName: string | undefined
  levelName: string | null
  point: number | undefined | null
  totalPoint: number | undefined | null
  experience: number | null | undefined
  weight: number
  height: number
  isLunar: number //生日是否农历 0 否 1 是,示例值(1)
  employeeId: number //所属员工ID,
}

// 获取当前门店会员列表
export function getUserPage(params: AnyObject) {
  return request.get('member/user/page', params, { isYuDaoAdmin: true })
}
// 获取当前会员标签精简列表
export function getSimpleTagList() {
  return request.get('member/tag/list-all-simple', {}, { isYuDaoAdmin: true })
}
// 查询用户分组 - 精简信息列表
export const getSimpleGroupList = async () => {
  return request.get('member/group/list-all-simple', {}, { isYuDaoAdmin: true })

}
// 创建会员用户
export const createUser = async (data: UserVO) => {
  return await request.put(`member/user/create`, data, { isYuDaoAdmin: true })
}

// 修改会员用户
export const updateUser = async (data: UserVO) => {
  return await request.put(`member/user/update`, data, { isYuDaoAdmin: true })
}
// 查询会员用户详情
export const getUser = async (id: number) => {
  return await request.get(`member/user/getMember?id=` + id, {}, { isYuDao: true })
}
/**
 * 重置密码
 */
export function resetPassword(data: AnyObject) {
  if (uni.getStorageSync('wapShopMember')) {
    data.id = uni.getStorageSync('wapShopMember').id;
  }
  return request.put(`member/user/update-paypasswd`, data, { isYuDaoAdmin: true, showErrorMessage: true })
}
